package com.ruoyi.hr.controller.hr.bginfo;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hr.service.bginfo.BgInfoService;
import com.ruoyi.hr.service.entryexitmanage.EntryExitManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author zeo
 * @explain 背景信息
 * @date 2020/3/26
 */

@Controller
@RequestMapping("/bgInfo")
public class BgInfoController extends BaseController {

    @Autowired
    BgInfoService bgInfoService;

    @Autowired
    EntryExitManageService entryExitManageService;

    private String prefix = "hr/bginfo";

    /**
     * 跳转分页页面
     */
    @GetMapping()
    public String bgInfo() {
        return prefix + "/bgInfo";
    }

    /**
     * 欢迎
     */
    @GetMapping("/welcome")
    public String welcome() {
        return prefix + "/welcome";
    }

    /**
     * 加载薪资管理左侧树状
     */
    @GetMapping("/treeData")
    @ResponseBody
    public List<Ztree> treeData() {
        List<Ztree> ztrees = new ArrayList<Ztree>();
        Ztree ztree[] = {
                new Ztree((long) 100, (long) 0, "员工基础信息", "员工基础信息"),
                new Ztree((long) 101, (long) 100, "员工基本信息", "员工基本信息"),
                new Ztree((long) 102, (long) 100, "员工详细信息", "员工详细信息"),

                new Ztree((long) 103, (long) 0, "员工背景信息", "员工背景信息"),
                new Ztree((long) 104, (long) 103, "教育经历", "教育经历"),
                new Ztree((long) 105, (long) 103, "工作经历", "工作经历"),
                new Ztree((long) 106, (long) 103, "职称/资格证书", "职称/资格证书"),
                new Ztree((long) 107, (long) 103, "培训经历", "培训经历"),
                new Ztree((long) 108, (long) 103, "项目经历", "项目经历"),
                new Ztree((long) 109, (long) 103, "奖惩经历", "奖惩经历"),
                new Ztree((long) 110, (long) 103, "家庭背景", "家庭背景"),
                new Ztree((long) 111, (long) 103, "紧急联系人", "紧急联系人"),
                new Ztree((long) 112, (long) 103, "证件管理", "证件管理"),
                new Ztree((long) 113, (long) 103, "语言能力", "语言能力"),
        };
        for (int i = 0; i < ztree.length; i++) {
            ztrees.add(ztree[i]);
        }
        return ztrees;
    }

    @GetMapping("/getEmp")
    public String getReportTo() {
        return prefix + "/getEmp";
    }

    @RequestMapping("/getEmpInfo")
    @ResponseBody
    public Map<String,Object> getEmpInfo(String eid){
        return bgInfoService.getEmpInfo(eid);
    }



}
